package com.niiwoo.civet.mobile.controller.kaola;

import com.alibaba.dubbo.config.annotation.Reference;
import com.niiwoo.civet.mobile.vo.request.kaola.KaoLaLiCaiWithholdConsRequestVO;
import com.niiwoo.civet.mobile.vo.response.koala.KaoLaLiCaiWithholdConstractResponseVO;
import com.niiwoo.civet.trade.service.contract.WithholdContractDubboService;
import com.niiwoo.tripod.web.annotation.AuthIgnore;
import com.niiwoo.tripod.web.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;

/**
 * 考拉理财app controller
 *
 * @author laichunjing
 * @date 2018/04/19
 */

@Slf4j
@RestController
@RequestMapping("/kaolalicai")
@Api(tags = "考拉理财代扣合同统一签署（赖春景）", description = "/kaolalicai")
public class KaoLaLiCaiWithholdController {

    @Reference(version = "1.0.0")
    private WithholdContractDubboService withholdContractDubboService;

    @PostMapping("/signWithholdConstract")
    @ApiOperation(value = "考拉理财还款未签署代扣合同的用户，此接口统一签署")
    @AuthIgnore
    public Result<KaoLaLiCaiWithholdConstractResponseVO> signWithholdConstract(@RequestBody @Valid KaoLaLiCaiWithholdConsRequestVO requestVO) {
        String result=withholdContractDubboService.withholdContractSign(requestVO.getUserId(),requestVO.getStatus(),requestVO.getChannelCode());
        KaoLaLiCaiWithholdConstractResponseVO vo=new KaoLaLiCaiWithholdConstractResponseVO();
        vo.setSignStatus(result);
        return Result.with(vo);
    }

}
